package com.qf.controller;

import com.github.pagehelper.PageInfo;
import com.qf.entity.AppC;
import com.qf.service.appService;
import com.qf.vo.MessageVo;
import com.qf.vo.PageVo;
import com.qf.vo.tableVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/app")
public class AppController {
    @Autowired
    private appService apps;

    @RequestMapping("/getAllApp")
    @ResponseBody
    public tableVo<AppC> test1(PageVo pageVo, AppC appC){

        tableVo<AppC> table=new tableVo<>();
        PageInfo<AppC> pageInfo=apps.findAllApp(pageVo,appC);
        table.setCount(pageInfo.getTotal());
        table.setCode("0");
        table.setMsg("success");
        table.setData(pageInfo.getList());

        return table;

    }
    @RequestMapping("/add")
    @ResponseBody
    public MessageVo test2(AppC appC){
        int a=apps.insertCustomer(appC);
        MessageVo message=new MessageVo();
        message.setStatus(a==1?true:false);
        message.setMessage(a==1?"success":"fail");
        message.setData(appC);
        return message;
    }

}
